<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      position: absolute;
      width: 100px;
      height: 100px;
      border: 1px solid #333;
      animation: myfirst 5s;
      animation: myfirst 5s forwards;
      /* animation: myfirst 5s backwards; */
    }
    @keyframes myfirst {
      0%   {background:red; left:0px; top:0px;}
      25%  {background:yellow; left:200px; top:0px;}
      50%  {background:blue; left:200px; top:200px;}
      75%  {background:green; left:0px; top:200px;}
      100% {background:red; left:0px; top:100px;}
    }
  </style>
</head>
<body>
  <div></div>
</body>
</html>